import PasswordInput from '../../../components/NewPassword'
import { connect } from 'dva'
const NewPassword = ({dispatch, content, modalControl}) => {
  const next = () => {
    dispatch({
      type: 'modules/getModules',
      payload: {
        title: '重置交易密码',
        process: 'resetPassword',
        businessId: '1231241208',
        pathname: '',
        tokenId: 'test',
      }
    })
  }
  const listData = [
    {
      key: 'password',
      value: '交易密码',
      errorContent: '请输入6位交易密码',
      className: 'haveNoBorder',
      reg:/^(\d{6})$/,
      children: {
        reg:/^(\d{6})$/,
        key: 'passwordConfirm',
        className: 'haveNoBorder',
        errorContent: '您输入的交易密码不一致,请重新输入'
      }
    }
  ]
  const passwordData = {
    listData,
    next,
    content,
    modalControl,
    closeModal: () => {
      dispatch({
        type: 'reset/changeModal',
        payload: {
          modalControl: false
        }
      })
    },
    showModal: (content) => {
      dispatch({
        type: 'reset/changeModal',
        payload: {
          modalControl: true,
          content
        }
      })
    }
  }
  return (
    <PasswordInput {...passwordData}></PasswordInput>
  )
}
export default connect(state => state.reset)(NewPassword)